<?php
namespace app\school\event\subscribes\school;

use app\admin\logic\system\Message;
use think\Event;

class School
{
    public function subscribe(Event $event)
    {
        // 提交了机构认证
        $event->listen('SchoolAuthSubmit', function ($school) {
            // 申请人信息
            $school = $school->appendRelationAttr('apply', ['user_phone' => 'phone', 'nick_name']);

            Message::send('机构审核提醒', '用户【' . $school->getAttr('nick_name') . '/' . $school->getAttr('user_phone') . '】提交了认证机构申请', 1, 'school');
        });
        // 机构分成比例审核
        $event->listen('SchoolSplitExamine', function ($data) {
            Message::send('机构分成比例审核提醒', $data['body'], $data['admin_user_id']);

        });
    }
}
